﻿using System;
using System.ComponentModel;
using System.Windows.Forms;

namespace TcpApplication{
    public partial class MainWindow : Form{
        
        private void SW_DoWork(object sender, DoWorkEventArgs e){
            Server.BuildServer(status);
        }
        
        private void CW_DoWork(object sender, DoWorkEventArgs e){
            Client.BuildClient(clientSatus,content.Text);
        }
        
        private void Send_Click(object sender,EventArgs args){
            if (!clientwork.IsBusy) {
                clientwork.RunWorkerAsync();
            }
        }
        
        private void Start_Click(object sender,EventArgs args){
            if (!serverwork.IsBusy) {
                serverwork.RunWorkerAsync();
            }
        }
        private void AddEvent(){
            start.Click += Start_Click;
            serverwork.DoWork += SW_DoWork;
            send.Click += Send_Click;
            clientwork.DoWork += CW_DoWork;
        }
        public MainWindow(){
            InitializeComponent();
            AddEvent();
        }
    }
}